package com.woniuxy02;

/**
 * @author 作者
 * @create 2025-08-29 14:23
 */
public class Test06 {
    public static void main(String[] args) {
        int[] a={1,2,3,4,5};
        int[] b=new int[a.length];
        System.out.println("反转前:");
        for (int i: a){
            System.out.print(i+"\t");
        }
        System.out.println();

//        int t;
//        for(int i=0;i<a.length/2;i++){
//            t=a[i];
//            a[i]=a[a.length-1-i];
//            a[a.length-1-i]=t;
//        }

        int t;
        for(int i=0,j=a.length-1;i<j;i++,j--){
            t=a[i];
            a[i]=a[j];
            a[j]=t;
        }


        System.out.println("反转后:");
        for (int i: a){
            System.out.print(i+"\t");
        }
        System.out.println();




    }
}
